Developer Documentation
PATH  Mac OS X Documentation > Developer Tools > The Objective-C Compiler


Previous | Contents | Next

Implicit Cast From void* to C++ Object Pointer

The ANSI C++ standard doesn't allow implicit casts from void* to any C++ object pointer type. When such a cast is detected, the C++ compiler issues a warning. For example, if aClass is some arbitrary class, the following implicit cast produces a warning:

void *vp1; aClass *obj1, *obj2; vp1 = &obj1; obj2 = vp1; // Warning: implicitly casts void pointer

You can still explictly cast with:

obj2 = (aClass *)vp1;


The Objective-C Compiler

Previous | Contents | Next